package cn.itcast.www.junitTest;

import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;

public class ExecJavac1 {

	public static void main(String[] args) {
		try {
			Runtime rt = Runtime.getRuntime();
			Process proc = rt.exec("D:\\program\\jdk1.7\\bin\\javac");
			InputStream stderr = proc.getErrorStream();
			InputStreamReader isr = new InputStreamReader(stderr);
			BufferedReader br = new BufferedReader(isr);
			String line = null;
			System.out.println("<ERROR>");
			while( (line = br.readLine()) != null){
				System.out.println(line);
			}
			System.out.println("/<ERROR>");
			int exitVal = proc.waitFor();
			System.out.println("Process exitValue:" + exitVal );
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}

}
